package com.study.controller;


import com.study.pojo.req.ArticleVo;
import com.study.pojo.resp.BaserResp;
import com.study.service.ArticleService;
import com.sun.prism.impl.paint.PaintUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/article")
//@CrossOrigin
public class ArticleController {

    @Autowired
    ArticleService articleService;


    @RequestMapping("/create")
    public BaserResp createArticle(@RequestBody ArticleVo articleVo){
        return articleService.createArticle(articleVo);
    }

    @RequestMapping("/findAll")
    public BaserResp findAll(){
        return articleService.findAll();
    }

    @RequestMapping("/findArticleById/{id}")
    public BaserResp findArticleById(@PathVariable("id")Integer id){
        return articleService.findArticleById(id);
    }
}
